<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>Hello APP</title>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/ali/css/api.css" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/ali/css/common.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/ali/css/win_login.css"/>
	</head>
	<body>
	<header>
		<span class="header-left" tapmode onclick="api.closeWin();"><img src="__PUBLIC__/ali/image/left.png" /></span>
		<h1>用户登录</h1>
	</header>
		<div class="content">
			<!--<img src="../../image/biaoti.png" />-->
			<!--<img src="../../image/header.png"  class="font"/>-->
			<!--			<form>-->
			<input type="text" name="mobile" id="mobile" placeholder="请输入手机号">
			<input type="password" name="password" id="password" placeholder="输入密码">
			<!--<input type="submit" value="登录"/>-->
			<button onclick="submit()">
				登录
			</button>		<!--</form>-->
			<!--<footer>-->
				<!--<div class="register" onclick="frm_register()">-->
					<!--快速注册-->
				<!--</div>-->
				<!--<div class="forgetPassword" onclick="frm_forgetPassword()">-->
					<!--忘记密码-->
				<!--</div>-->
			<!--</footer>-->
		</div>
	</body>
	<script type="text/javascript" src="__PUBLIC__/ali/script/api.js"></script>
	<script type="text/javascript" src="__PUBLIC__/ali/script/common.js"></script>
	<script type="text/javascript">
		apiready = function() {
		};
		function frm_register() {
			api.openFrame({
				name : 'frm_register',
				url : 'frm_register.html',
				delay : 300,
				animation : {
					type : 'movein',
					subType : 'from_right'
				}
			});
		}

		function frm_forgetPassword() {
			api.openFrame({
				name : 'frm_forgetPassword',
				url : 'frm_forgetPassword.html',
				delay : 300,
				animation : {
					type : 'movein',
					subType : 'from_right'
				}
			});
		}

		function submit() {
			  window.location.href="product";
			re = /^(13[0-9]{9})|(15[0-9]{9})|(17[0-9]{9})|(18[0-9]{9})$/;
			var mobile = $api.trimAll($api.val($api.byId('mobile')));
			var password = $api.trimAll($api.val($api.byId('password')));
			if (!re.test(mobile)) {
				api.toast({
					msg : "请输入正确的手机号码",
					duration : 2000,
					location : 'bottom'//'top'
				});
				return false;
			}
			if (!password) {
				api.toast({
					msg : "请输入密码",
					duration : 2000,
					location : 'bottom'//'top'
				});
				return false;
			}
			api.ajax({
				url : ajaxUrl + '/Login/index',
				method : 'post',
				charset : 'UTF-8',
				data : {
					values : {
						mobile : mobile,
						password : password
					},
				}
			}, function(ret, err) {
				if (ret) {
					if (ret.errno == 200) {
						api.toast({
							msg : "登录成功",
							duration : 2000,
							location : 'bottom'//'top'
						});
						$api.setStorage('token', ret['tpl_data']['token']);
						$api.setStorage('uid', ret['tpl_data']['uid']);
						$api.setStorage('sig_parameter', ret['tpl_data']['sig_parameter']);
					}
				} else {
				}
			});
		}
	</script>
</html>